use diesel::{Connection, PgConnection};

pub fn establish_connection() -> PgConnection {
    // dotenv().ok();
    let database_url = "postgres://postgres:af12g3k4SHF@192.168.8.20/nail";
    PgConnection::establish(&database_url)
        .unwrap_or_else(|_| panic!("Error ------- to {}", database_url))
}

pub struct Repo(PgConnection);

impl Repo {
    pub(crate) fn new(pg: PgConnection) -> Repo {
        return Repo(pg);
    }
}
